<? include ("../init.php") ?>
<? include ("../header.php") ?>
<? include ("../menu.php") ?>
<? include ("submenu.php") ?>
<?php

  $aid = $_GET['aid'];

  $sql = "SELECT * FROM hs_category WHERE c_id= '".$aid."'";
  $line = $db->queryUniqueObject($sql);
?>
<div id = "body">

<h1><?_l('Edit Category')?></h1>

<div class = "clear"></div>

<form method="post" action="update.php" class = "form" enctype="multipart/form-data">
  <input name="aid" type="hidden" value="<?=$aid?>"/>
  
  <div class = "field"><label><?_l('name')?></label><input type = "text" name = "name" class = "input size1" value = "<?=$line->c_name?>" ></div>
  
  <div class = "field"><label><?_l('image 1')?></label><input type = "file" name = "image1" class = "input size1" > * ขนาด 239x312 pixel</div>
  <?php
    if($line->c_img1!='' && file_exists('../../images/products/category/'.$line->c_id.'/'.$line->c_img1)){
      echo '<div class = "field"><label>&nbsp;</label><img src="../../images/products/category/'.$line->c_id.'/'.$line->c_img1.'" /></div>';
      echo '<input type="hidden" name="oldimg1" value="'.$line->c_img1.'" />';
    }
  ?>
  
  <div class = "field"><label><?_l('image 2')?></label><input type = "file" name = "image2" class = "input size1" > * ขนาด 128x37 pixel</div>
  <?php
    if($line->c_img2!='' && file_exists('../../images/products/category/'.$line->c_id.'/'.$line->c_img2)){
      echo '<div class = "field"><label>&nbsp;</label><img src="../../images/products/category/'.$line->c_id.'/'.$line->c_img2.'" /></div>';
      echo '<input type="hidden" name="oldimg2" value="'.$line->c_img2.'" />';
    }
  ?>
  
  <div class = "field"><label></label>
    <input type="submit" name="save" value = "<?_l('update')?>" class = "btn" />
    <input onclick = "javascript:history.back(1)" type = "button" value="<?_l('cancel')?>" class = "btn" />
  </div>
  
  <div class = "clear"></div>
</form>

</div>


<style>
  .form label {
    width:80px;
  }
</style>
<? include ("../footer.php") ?>